using System.Reflection;
using Castle.Core;
using KenEgozi.Com.Domain.Aggregates.Post;
using KenEgozi.Com.Domain.Interfaces.Repositories;
using KenEgozi.Com.Domain.Repositories;
using Rhino.Commons;

namespace KenEgozi.Com.Domain.Tests
{
	public class IoCContainer : RhinoContainer
	{
		public void Initialize()
		{
			AddFacility("RhinoTransactionFacility", new RhinoTransactionFacility());
			IUnitOfWorkFactory unitOfWorkFactory = new ActiveRecordUnitOfWorkFactory(new Assembly[] { typeof(Post).Assembly});
			Kernel.AddComponentInstance("ActiveRecordUnitOfWorkFactory", typeof(IUnitOfWorkFactory), unitOfWorkFactory);

			AddComponentWithLifestyle<IPostsRepository, PostsRepository>(LifestyleType.Singleton);
		}
	}
}
